package pers.cmc.mysql;

import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;
import pers.cmc.mysql.core.Pool;
import pers.cmc.mysql.core.Reflex;
import pers.cmc.mysql.model.Config;
import pers.cmc.mysql.model.Select;
import pers.cmc.mysql.util.StringUtils;

import java.sql.Array;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

@SpringBootApplication
@Component
public class JavaMysqlApplication {
    @Autowired
    Config config;

    public static void main(String[] args) throws SQLException, InterruptedException, IllegalAccessException {
        ConfigurableApplicationContext springApplication = SpringApplication.run(JavaMysqlApplication.class, args);
        System.out.println("mysql框架启动成功");
        JavaMysqlApplication app = (JavaMysqlApplication) springApplication.getBean(JavaMysqlApplication.class);

        app.start();
    }



    public void start() throws SQLException, InterruptedException, IllegalAccessException {
//        // 启动连接池
//        Pool pool = new Pool(config);
//
//        List<Map<String,Object>> resultSet = pool.select("select * from user");
//
//        System.out.println(JSON.toJSONString(resultSet));
//
//        System.out.println(StringUtils.toSmallHump("User_id"));
        String[] a = {};

    }
}
